<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>已发布宝贝列表</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="<%=basePath%>res/css/main.css">
<link rel="stylesheet" href="<%=basePath%>res/css/lrtk.css">
<link rel="stylesheet" href="<%=basePath%>res/css/search.css">
<script src="<%=basePath%>res/js/jquery.js"></script>
<script src="<%=basePath%>res/js/jdt.js"></script>
<style type="text/css">
html {
	overflow: hidden;
}
</style>
<script type="text/javascript">
	function check() {
		var msg = ${msg};
		if (msg != null) {
			alert(msg);
		}
	}
</script>
</head>
<body onload="check();">
	<div style="width: 100%;height: 100%;">
		<c:if test="${! empty goodses }">
			<table>
				<tr align="center">
					<td width="5%">ID</td>
					<td width="15%">名称</td>
					<td width="15%">类别</td>
					<td width="10%">价格</td>
					<td width="10%">状态</td>
					<td width="15%">顾客</td>
					<td width="10%">修改</td>
					<td width="10%">删除</td>
					<td width="10%">详情</td>
				</tr>
				<c:forEach items="${goodses }" var="goods">
					<tr align="center">
						<td>${goods.goodsId }</td>
						<td>${goods.goodsName }</td>
						<td>${goods.goodsCategory }</td>
						<td>${goods.goodsPrice}</td>
						<c:if test="${goods.goodsStatus == 0 }">
							<td>待售中</td>
						</c:if>
						<c:if test="${goods.goodsStatus != 0 }">
							<td>已售</td>
						</c:if>
						<td>${goods.goodsBoughtUserId }</td>
						<c:if test="${! empty sessionScope.currUser}">
							<td><a href="alterAction.action?id=${goods.goodsId}">[修改]</a></td>
						</c:if>
						<c:if test="${! empty sessionScope.currUser}">
							<td><a href="deleteAction.action?id=${goods.goodsId}"
								target="context">[删除]</a></td>
						</c:if>
						<c:if test="${! empty sessionScope.currUser}">
							<td><a href="detailAction.action?id=${goods.goodsId}">[查看]</a></td>
						</c:if>
					</tr>
				</c:forEach>
				<tr>
					<td>&nbsp;</td>
				</tr>
				<tr align="center">
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td colspan="3"><a href="published.action?currentPage=1">首页</a>
						<a href="published.action?currentPage=${page.prePage }">上一页</a> 
						<c:forEach begin="1" end="${ page.totalPageNumber }" var="i">
							<c:if test="${i eq page.currentPage }">
    							${i}&nbsp;&nbsp;
    						</c:if>
							<c:if test="${not ( i eq page.currentPage) }">
								<a href="published.action?currentPage=${i}">${i}</a>&nbsp;&nbsp;
    						</c:if>


						</c:forEach> <a href="published.action?currentPage=${page.nextPage }">下一页</a>
						<a href="published.action?currentPage=${page.totalPageNumber }">尾页</a></td>
				</tr>
			</table>
		</c:if>

		<c:if test="${ empty goodses }">
			<p>你还没有发布商品，点击“</p>
			<a href="publishgoods.jsp" target="context">发>发布商品</a>
			<p>”来发布</p>
		</c:if>
	</div>
</body>
</html>

